<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="jca" uri="http://www.ptc.com/windchill/taglib/components"%>
<%@ include file="/netmarkets/jsp/util/beginPopup.jspf"
%>
<%@ taglib prefix="wrap" uri="http://www.ptc.com/windchill/taglib/wrappers"%>
<%@ taglib prefix="wctags" tagdir="/WEB-INF/tags"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/fmt" prefix="fmt"%>

<%@ taglib prefix="mvc" uri="http://www.ptc.com/windchill/taglib/jcaMvc"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/mvc" prefix="mvc2"%>
 <%@ taglib prefix="jca" uri="http://www.ptc.com/windchill/taglib/components"%> 
 <%@page import="java.util.*"%>
 <%@page import="java.io.*"%>
<%@page import="java.util.ArrayList"%>
<%@page import="wt.fc.Persistable"%>
<%@page import="wt.fc.PersistenceHelper"%>
<%@page import="wt.fc.QueryResult"%>
<%@page import="wt.fc.ReferenceFactory"%>
<%@page import="wt.util.WTException"%>
<%@page import="wt.query.QuerySpec"%>
<%@page import="wt.part.WTPart"%>
<%@page import="wt.doc.WTDocument"%>
<%@page import="wt.vc.wip.WorkInProgressHelper"%>
<%@page import="com.webridge.plm.util.FileUtil"%>
<%
//get Product names

        try {
            java.io.File f = new java.io.File("/tmp");
            for (java.io.File s : f.listFiles()) {
              out.println(s.getName());
              out.println(s.exists()+"<br/>");
            }
            String strAttachmentFilePath="/tmp/疯狂动物城BD国英双语双字[电影天堂www.dy2018.com].mkv";
            String attachementName = "疯狂动物城BD国英双语双字[电影天堂www.dy2018.com].mkv";
            File asrc = new File(strAttachmentFilePath);
            if(asrc!=null&&asrc.exists()){
            WTDocument doc = FileUtil.getLatestWTDocument("0000000001");
            
            
            WTDocument workingDoc = FileUtil.getWorkingCopyOfDoc(doc);

           
            
            workingDoc = (WTDocument)FileUtil.addAttachment(workingDoc, strAttachmentFilePath, attachementName);
            WorkInProgressHelper.service.checkin(workingDoc, "update attachment");}
            else{
                out.println("File :"+strAttachmentFilePath+" not exists.");
            }
        } catch (WTException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            out.println("upload exception 1:"+e.getLocalizedMessage());
        }catch (WTPropertyVetoException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            out.println("upload exception 2:"+e.getLocalizedMessage());
        }
      
    
out.println("upload success.");

%>

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 <%@include file="/netmarkets/jsp/util/end.jspf"%> 
